<!DOCTYPE html>
<html>
<head>
	<title>E8NET</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <include file="./App/Admin/View/Include/css.html" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/tables.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

    <include file="./App/Admin/View/Include/navbar.html" />
    <include file="./App/Admin/View/Include/menu.html" />


	<!-- main container -->
    <div class="content">

        <div class="container-fluid">
            <div id="pad-wrapper">

                <!-- orders table -->
                <div class="table-wrapper orders-table id">
                    <div class="row-fluid head">
                        <div class="span12">
                            <h4>作息时间表管理</h4>
                        </div>
                    </div>

                    <div class="row-fluid filter-block">
                        <div class="pull-right">
                            <a href="#" class="btn-flat success new-product">+ 更新时间表</a>
                        </div>
                    </div>

                    <div class="row-fluid">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th class="span2">
                                    描述
                                </th>
                                <th class="span3">
                                    <span class="line"></span>
                                    时间段
                                </th>
                                <th class="span3">
                                    <span class="line"></span>
                                    持续时长
                                </th>
                                <th class="span1">
                                    <span class="line"></span>ACTION
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- row -->
                            <volist name="scheduleArr" id="schedule">
                                <tr>
                                    <td>{$schedule.name}</td>
                                    <td>{$schedule.stime} ~ {$schedule.etime}</td>
                                    <td>{$schedule.length}</td>
                                    <td class="">
                                        <div class="ui-dropdown">
                                            <div class="head" style="padding:4px; font-size:12px;" data-toggle="tooltip" title="">
                                                修改
                                            </div>
                                            <div class="dialog">
                                                <div class="pointer">
                                                    <div class="arrow"></div>
                                                    <div class="arrow_border"></div>
                                                </div>
                                                <div class="body" style="width:400px;">
                                                    <div class="form" style="">
                                                        <input class="inline-input" id="stime{$schedule.id}" value="{$schedule.stime}" style="width: 100px;  margin-right:5px;" placeholder="开始时间" type="text" />
                                                        <input class="inline-input" id="etime{$schedule.id}" value="{$schedule.etime}" style="width: 100px;  margin-right:5px;" placeholder="结束时间" type="text" />
                                                        <input class="inline-input" id="length{$schedule.id}" value="{$schedule.length}" style="width: 100px;  margin-right:5px;" placeholder="时长" type="text" />
                                                        <a href="javascript:scheduleHandler({$schedule['id']});" class="btn-flat gray small" style="padding: 4px 14px; margin-top:3px;">提交处理</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- end orders table -->

            </div>
        </div>
    </div>
    <!-- end main container -->

	<include file="./App/Admin/View/Include/js.html" />

    <script>
        function scheduleHandler (id) {
            var stime = $('#stime' + id).val();
            var etime = $('#etime' + id).val();
            var length = $('#length' + id).val();

            $.post("__APP__/Schedule/handler",{id:id,stime:stime,etime:etime,length:length},function(result){
                var obj = eval('(' + result + ')');
                if (obj.result == 'RESULT_OK') {
                    //window.location.href = obj.data;
                    location.reload();
                } else {
                    alert(obj.msg);
                }
            });
        }
    </script>

</body>
</html>